home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 5983 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: mail2news.demon.co.uk!genesis.demon.co.uk
  2. From: Lawrence Kirby <fred@genesis.demon.co.uk>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Character String --> Integer
  5. Date: Thu, 22 Feb 96 00:37:00 GMT
  6. Organization: none
  7. Message-ID: <824949420snz@genesis.demon.co.uk>
  8. References: <4fb0ga$lsa@remus.rutgers.edu> <4ffr4e$4ji@madeline.INS.CWRU.Edu> <1996Feb20.185030.22691@cs.mun.ca>
  9. Reply-To: fred@genesis.demon.co.uk
  10. X-NNTP-Posting-Host: genesis.demon.co.uk
  11. X-Newsreader: Demon Internet Simple News v1.27
  12. X-Mail2News-Path: genesis.demon.co.uk
  13.  
  14. In article <1996Feb20.185030.22691@cs.mun.ca>
  15.            sjt@cs.mun.ca "Stephen J. Tremblett" writes:
  16.  
  17. >
  18. >
  19. >I did this very recently in an assig.
  20. >A char variable is just an int interpreted into the values of the ascii
  21. >table.  A char variable - 48 (ascii for 0) will result in the integer
  22. >value of that digit.
  23.  
  24. But there is no need to know or even care what the ASCII calue for 0 is.
  25. Just subtract '0' from the digit value and it will give you the integer
  26. value whatever the underlying character set.
  27.  
  28. -- 
  29. -----------------------------------------
  30. Lawrence Kirby | fred@genesis.demon.co.uk
  31. Wilts, England | 70734.126@compuserve.com
  32. -----------------------------------------
  33.